import { createApp } from 'vue'
import ElementPlus from 'element-plus'

/* 样式 */
import 'element-plus/dist/index.css'
import '@/assets/icon/iconfont.css'
import '@/assets/icon/iconfont.js'
import '@/assets/base.scss'

import App from './App.vue'
import router from './router'
import * as Pinia from 'pinia'

/* 自定义的工具 */
import Utils from '@/utils/Utils'
import Verify from '@/utils/Verify'
import Request from '@/utils/Request'
import Message from '@/utils/Message'
import Api from '@/utils/Api'
import Confirm from '@/utils/Confirm'

/* 全局组件 */
import Layout from '@/components/Layout.vue'
import WinOp from '@/components/WinOp.vue'
import Blank from '@/components/Blank.vue'
import ContentPanel from '@/components/ContentPanel.vue'
import ShowLocalImage from '@/components/ShowLocalImage.vue'
import UserBaseInfo from '@/components/UserBaseInfo.vue'
import Dialog from '@/components/Dialog.vue'
import Avatar from '@/components/Avatar.vue'
import AvatarUpload from '@/components/AvatarUpload.vue'
import Badge from '@/components/Badge.vue'
import Table from '@/components/Table.vue'

const app = createApp(App)
app.use(ElementPlus) // 使用element plus
app.use(router) // 使用路由
app.use(Pinia.createPinia()) // 使用pinia

/* 全局注册组件 */
app.component('Layout', Layout)
app.component('WinOp', WinOp)
app.component('Blank', Blank)
app.component('ContentPanel', ContentPanel)
app.component('ShowLocalImage', ShowLocalImage)
app.component('UserBaseInfo', UserBaseInfo)
app.component('Dialog', Dialog)
app.component('Avatar', Avatar)
app.component('AvatarUpload', AvatarUpload)
app.component('Badge', Badge)
app.component('Table', Table)

/* 使用自定义工具 */
app.config.globalProperties.Utils = Utils
app.config.globalProperties.Verify = Verify
app.config.globalProperties.Request = Request
app.config.globalProperties.Message = Message
app.config.globalProperties.Api = Api
app.config.globalProperties.Confirm = Confirm

app.mount('#app')
